Skip to content

feat!: add location#114

Merged
dargmuesli merged 13 commits intobetafrom
feat/gps-coordinates
Jan 25, 2025
Merged

feat!: add location#114
dargmuesli merged 13 commits intobetafrom
feat/gps-coordinates

Conversation

@sthelemann
Copy link
Copy Markdown
Contributor

A new table location is created to accommodate location data of an account or an event based on GPS coordinates. The new function `distance' calculates the linear distance between two locations.

A new table `location` is created to accommodate location data of an account or an event based on GPS coordinates. The new function `distance' calculates the linear distance between two locations.
@sthelemann sthelemann requested a review from dargmuesli January 16, 2025 16:46
Copy link
Copy Markdown
Member

@dargmuesli dargmuesli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the submission, there are just a few lines that likely weren't intended to be submit as is.

What do you think about the earthdistance module?

@dargmuesli dargmuesli changed the title feat(location): add location data feat: add location Jan 17, 2025
Copy link
Copy Markdown
Member

@dargmuesli dargmuesli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by mistake

@dargmuesli dargmuesli force-pushed the feat/gps-coordinates branch from 7f8948f to 6a75845 Compare January 19, 2025 19:46
@dargmuesli dargmuesli changed the base branch from master to beta January 19, 2025 20:04
sthelemann and others added 4 commits January 21, 2025 12:12
Instead of working with the original GPS coordinates we use the data type GEOMETRY from the PostGIS extension. Table `maevs.location`was dropped in favor of GEOMETRY typed columns in tables `maevsi_private.account' and `maevsi.event'. A collection of location related functions was added in a single source code file `function_package_location.sql`similar to the package feature in Oracle which is missing in PostgreSQL.
Necessary for the Postgraphile PostGIS module.
@dargmuesli
Copy link
Copy Markdown
Member

I'm working on providing a postgraphile image that includes its PostGIS plugin over at https://github.com/maevsi/postgraphile. Also, in my testing, the geography gave way better results than geometry so I switched those.

@sthelemann
Copy link
Copy Markdown
Contributor Author

What do you think about the earthdistance module?

I found https://hashrocket.com/blog/posts/juxtaposing-earthdistance-and-postgis and recommend staying with PostGIS.

@sthelemann
Copy link
Copy Markdown
Contributor Author

Also, in my testing, the geography gave way better results than geometry so I switched those.

Calculations using GEOMETRY instead of GEOMETRY are slower, so I thought we couild live with a trade-off in accuracy. I have been assuming that distances between e.g. New York and Berlind are irrelevent because we focus on a local/regional scope.

See https://postgis.net/docs/manual-3.5/using_postgis_dbmanagement.html#PostGIS_Geometry, section 4.3.3, for more details.

Queries on dictionary tables were added to the  verification scripts for spatial indexes.
@dargmuesli
Copy link
Copy Markdown
Member

Assuming your mean GEOGRAPHY is slower than GEOMETRY, I chose GEOGRAPHY over GEOMETRY still as I see the case of an incorrect distance to events outside of Germany to be more confusing and obvious to users than a response time increase of apparently 1-20 milliseconds.

@dargmuesli dargmuesli changed the title feat: add location feat!: add location Jan 25, 2025
@dargmuesli dargmuesli force-pushed the feat/gps-coordinates branch from 8fdd930 to c8f1a9f Compare January 25, 2025 20:16
Copy link
Copy Markdown
Member

@dargmuesli dargmuesli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@dargmuesli dargmuesli merged commit 8d9a9d1 into beta Jan 25, 2025
@dargmuesli dargmuesli deleted the feat/gps-coordinates branch January 25, 2025 20:20
maevsi-bot pushed a commit that referenced this pull request Jan 25, 2025
## [5.0.0-beta.3](5.0.0-beta.2...5.0.0-beta.3) (2025-01-25)

### ⚠ BREAKING CHANGES

* add location (#114)
* **event:** add full text search (#121)
* **extension:** add postgis (#119)
* **grafana:** remove (#107)
* **timestamp:** add time zone (#92)

### Features

* **account:** add login using email address ([#112](#112)) ([937d255](937d255))
* **account:** add possibility to block ([#73](#73)) ([4ab872e](4ab872e))
* **achievement:** add early bird achievement ([#111](#111)) ([0238bea](0238bea))
* add language enumeration ([76a1465](76a1465))
* add location ([#114](#114)) ([8d9a9d1](8d9a9d1))
* **contact:** add language ([669570f](669570f))
* **contact:** add nickname ([8b7169a](8b7169a))
* **contact:** add timezone ([02da0f9](02da0f9))
* **event_upload:** adjust policies. ([23eb8f4](23eb8f4))
* **event-category-mapping:** check if invited ([4ba7dac](4ba7dac))
* **event:** add full text search ([#121](#121)) ([83533e9](83533e9))
* **event:** add visibility unlisted ([#126](#126)) ([759c4d4](759c4d4))
* **event:** assign images to events ([f4822f8](f4822f8))
* **event:** mark events as favourite ([#109](#109)) ([7b75524](7b75524))
* **extension:** add postgis ([#119](#119)) ([5a24dfa](5a24dfa))
* **grafana:** remove ([#107](#107)) ([960b978](960b978))
* **invitation:** add update metadata ([f493fe4](f493fe4))
* **invitation:** column names prefixed ([2e29431](2e29431))
* **invitation:** provide flattened invitations ([119b0dd](119b0dd))
* **policy:** add policy to recommendation tables ([280f47b](280f47b))
* **recommendation:** add enum and tables needed for event recommendation ([7fb5e21](7fb5e21))
* **recommendation:** several modifications to db schema ([8581ad0](8581ad0))
* **revert:** add revert for recommendation tables ([cff0b7f](cff0b7f))
* **schema:** fix small errors and build schema ([3183da0](3183da0))
* **table:** add creation timestamps ([d8d142d](d8d142d))
* **timestamp:** add time zone ([#92](#92)) ([d36d378](d36d378))
* **verify:** add verification for event recommendation tables ([1d6bb59](1d6bb59))

### Bug Fixes

* **account-block:** remove bug in function, create new table function ([#125](#125)) ([35b22b4](35b22b4))
* **build:** commit forgotten files ([d554d0f](d554d0f))
* **event-upload:** work in feedback ([678ddfc](678ddfc))
* **invitation-flat:** work in feedback ([6ac75ac](6ac75ac))
* **invoker-account-id:** grant execute for tusd ([#123](#123)) ([7245225](7245225))
* **legal-term-acceptance:** omit update and delete ([555e031](555e031))
* omit update for creation timestamps ([084ad1e](084ad1e))
* **policy:** fix user check in event category mapping policy ([3dfd96a](3dfd96a))
* **role:** drop before creation ([#106](#106)) ([fecd16e](fecd16e))
* schedule release ([6e32e10](6e32e10))
* schedule release ([7dbc9bb](7dbc9bb))
* **schema:** remove table prefix so schema can be build ([cc5be2d](cc5be2d))
@maevsi-bot
Copy link
Copy Markdown

🎉 This PR is included in version 5.0.0-beta.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

maevsi-bot pushed a commit that referenced this pull request Feb 27, 2025
## [5.0.0](4.13.5...5.0.0) (2025-02-27)

### ⚠ BREAKING CHANGES

* **role:** read usernames from secrets (#49)
* **event:** allow to mark upload as header image (#144)
* **index:** merge into table definitions (#147)
* **address:** correct reference columns' name suffix (#140)
* **invitation:** rename to guest (#122)
* **event-favorite:** align to general schema (#135)
* add address (#134)
* **contact:** add note (#133)
* add location (#114)
* **event:** add full text search (#121)
* **extension:** add postgis (#119)
* **grafana:** remove (#107)
* **timestamp:** add time zone (#92)
* **notification:** align timestamp column name
* **account:** rename `created` column to `created_at`

### Features

* **account:** rename `created` column to `created_at` ([df18548](df18548))
* add address ([#134](#134)) ([97a8645](97a8645))
* add location ([#114](#114)) ([8d9a9d1](8d9a9d1))
* **address:** add location ([55fc3e5](55fc3e5))
* **address:** correct reference columns' name suffix ([#140](#140)) ([9039aee](9039aee)), closes [#138](#138) [#141](#141) [#138](#138)
* **address:** simplify policies ([cd4787e](cd4787e))
* **contact:** add note ([#133](#133)) ([153fd3f](153fd3f))
* **device:** add ([27c156c](27c156c))
* **device:** prevent token value updates ([4bd0d0f](4bd0d0f))
* **device:** work in feedback ([9b7c451](9b7c451))
* **event-favorite:** align to general schema ([#135](#135)) ([87d45df](87d45df))
* **event:** add full text search ([#121](#121)) ([83533e9](83533e9))
* **event:** add visibility unlisted ([#126](#126)) ([759c4d4](759c4d4))
* **event:** allow to mark upload as header image ([#144](#144)) ([25e76dd](25e76dd))
* **extension:** add postgis ([#119](#119)) ([5a24dfa](5a24dfa))
* **friend:** complete the friend feature ([50c7644](50c7644))
* **friend:** draft ([c972eb1](c972eb1))
* **friends:** add tests ([93cf92d](93cf92d))
* **friends:** add tests ([df1fa0c](df1fa0c))
* **friends:** add tests ([54de3f8](54de3f8))
* **friends:** add tests ([12914f5](12914f5))
* **friends:** add tests ([8c9dbb4](8c9dbb4))
* **friends:** give names to check constraints ([eb46d17](eb46d17))
* **friendship:** improve constraint names ([24309dc](24309dc))
* **friendship:** rename `pending` enum to `requested` ([667e475](667e475))
* **friendship:** restrict update depending on friendship state ([bf599b9](bf599b9))
* **friendship:** work in feedback ([18f894e](18f894e))
* **grafana:** remove ([#107](#107)) ([960b978](960b978))
* **invitation:** rename to guest ([#122](#122)) ([49b20ed](49b20ed))
* **metadata:** rename author to creator ([#136](#136)) ([55381ff](55381ff))
* **notification:** align timestamp column name ([92b2ec2](92b2ec2))
* **role:** read usernames from secrets ([#49](#49)) ([2a413f6](2a413f6)), closes [#154](#154)
* **timestamp:** add time zone ([#92](#92)) ([d36d378](d36d378))

### Bug Fixes

* **account-block:** bug fixes in functions and policies ([#139](#139)) ([8d71f87](8d71f87))
* **address:** expose creator id for insertion ([514f6bb](514f6bb))
* **device:** correct permissions ([bccfe40](bccfe40))
* **device:** tune policies ([14ca9cc](14ca9cc))
* **friendship:** add missing not-null constraint ([2119a5e](2119a5e))
* **friendship:** add usage of enum type to `sqitch.plan` ([329de43](329de43))
* **friendship:** remove status `rejected` and function `friendship_account_ids` ([c083f6c](c083f6c))
* **location:** move test function to appropriate schema ([#130](#130)) ([e5b4a36](e5b4a36))

### Performance Improvements

* **event:** early return search trigger function ([#132](#132)) ([697da38](697da38))
* **index:** merge into table definitions ([#147](#147)) ([20b8c5d](20b8c5d)), closes [#149](#149)
@maevsi-bot
Copy link
Copy Markdown

🎉 This PR is included in version 5.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants